Open
Conversation
2754LM
commented
Mar 23, 2026
- 问题:common 模块包名缺少 com.kama 前缀,导致 SPI 配置文件路径不匹配
- 解决:选择代码修改量较小的方案,直接修改 SPI 配置文件路径和内容:移除 com.kama 前缀。
- 测试:添加 SPI 加载测试类
- 问题:common 模块包名缺少 'com.kama' 前缀,导致 SPI 配置文件路径不匹配 - 解决:选择代码修改量较小的方案,直接修改 SPI 配置文件路径和内容:移除com.kama前缀。 - 测试:添加 SPI 加载测试类
There was a problem hiding this comment.
Pull request overview
该 PR 通过调整自定义 SPI 的配置文件路径/内容,使其与 common 模块当前的包名(不含 com.kama 前缀)保持一致,从而修复 SPI 资源无法被 SpiLoader 正确加载的问题,并补充了 SPI 加载的测试用例验证。
Changes:
- 将序列化器 SPI 配置文件从
META-INF/serializer/com.kama.common.serializer.myserializer.Serializer调整为META-INF/serializer/common.serializer.myserializer.Serializer(并同步更新实现类全限定名)。 - 删除旧的(带
com.kama前缀的)SPI 配置文件。 - 为 version5 / version6 各新增一个
SpiTest,验证可按 key 获取到对应序列化器实现。
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| version6/krpc-core/src/main/resources/META-INF/serializer/common.serializer.myserializer.Serializer | 新增正确命名的 SPI 配置文件,供 SpiLoader 按接口 FQN 加载 |
| version6/krpc-core/src/main/resources/META-INF/serializer/com.kama.common.serializer.myserializer.Serializer | 删除旧的、路径不匹配的 SPI 配置文件 |
| version6/krpc-core/src/main/java/com/kama/test/serializer/SpiTest.java | 新增 SPI 加载/按 key 获取实例的测试 |
| version5/krpc-core/src/main/resources/META-INF/serializer/common.serializer.myserializer.Serializer | 同步新增 version5 的正确 SPI 配置文件 |
| version5/krpc-core/src/main/resources/META-INF/serializer/com.kama.common.serializer.myserializer.Serializer | 同步删除 version5 的旧 SPI 配置文件 |
| version5/krpc-core/src/main/java/com/kama/test/serializer/SpiTest.java | 同步新增 version5 的 SPI 测试 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
version6/krpc-core/src/main/java/com/kama/test/serializer/SpiTest.java
Outdated
Show resolved
Hide resolved
...5/krpc-core/src/main/resources/META-INF/serializer/common.serializer.myserializer.Serializer
Outdated
Show resolved
Hide resolved
version5/krpc-core/src/main/java/com/kama/test/serializer/SpiTest.java
Outdated
Show resolved
Hide resolved
...6/krpc-core/src/main/resources/META-INF/serializer/common.serializer.myserializer.Serializer
Outdated
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.